define(['jq', 'common'], () => {
    //首部复用
    $('header').load('../html/header.html')
    //尾部复用
    $('footer').load('../html/footer.html')
    setTimeout(() => {
        //购物车数量
        let em1 = document.querySelectorAll('em')[0]
        let em2 = document.querySelectorAll('em')[1]
        let span = document.querySelector('.save span')
        let list = JSON.parse(localStorage.getItem('cart')) || []
        // console.log(list);
        //购物车数量
        let count = 0
        list.map((item) => {
            count += item.cart_number
            
        })
        // console.log(count);
        em1.innerHTML = count
        em2.innerHTML = count

        //收藏夹数量
        let shoucang = document.querySelector('.save span')
        let collect = JSON.parse(localStorage.getItem('collection')) || []
        console.log(collect);
        let num = collect.length
        console.log(num);
        shoucang.innerHTML = num

        //头像放大
        let touxiang = document.querySelector('.touxiang')
        let mask = document.querySelector('.mask')
        let del = document.querySelector('.del')
        touxiang.addEventListener('click',function () {
            mask.style.display = 'block'
        })
        del.addEventListener('click',function () {
            mask.style.display = 'none'
        })
        
    }, 500)
})